import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { ArenaRewardInfo } from "./info/ArenaRewardInfo";
import { EArenaProcess } from "../../../Message/Public/EArenaProcess";
import { KingwarNoteType } from "../view/kingWarAd/KingwarNoteType";
type int = number;
//class ArenaRewardConfig
    
    export  class ArenaRewardConfig
    {
        constructor()
        {
            
            this._audArr = [];
            this._groupArr = [];
            this._finalArr = [];
            if (ArenaRewardConfig._instance != null) 
            {
                throw new Error(" ArenaRewardConfig 单例 ");
            }
            this.init();
            return;
        }

        public init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_arena_reward_config.json");
            this.write(loc1);
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                loc1 = new ArenaRewardInfo();
                loc1.id = loc2.id;
                loc1.maxRank = loc2.maxRank;
                loc1.minRank = loc2.minRank;
                loc1.process = loc2.process;
                loc1.rewardCode = loc2.rewardCode;
                loc1.rewardNum = loc2.rewardNum;
                loc1.isFinal = loc2.isFinal ? loc2.isFinal : 0;
                if (loc1.isFinal != 0) 
                {
                    continue;
                }
                if (loc2.process == EArenaProcess._EArenaElimination1 || loc2.process == EArenaProcess._EArenaElimination2 || loc2.process == EArenaProcess._EArenaElimination3 || loc2.process == EArenaProcess._EArenaElimination4) 
                {
                    this._audArr.push(loc1.rewardCode);
                    continue;
                }
                if (loc2.process == EArenaProcess._EArenaGroupMatch1 || loc2.process == EArenaProcess._EArenaGroupMatch2) 
                {
                    this._groupArr.push(loc1.rewardCode);
                    continue;
                }
                if (!(loc2.process == EArenaProcess._EArenaFinalMatch1 || loc2.process == EArenaProcess._EArenaFinalMatch2)) 
                {
                    continue;
                }
                this._finalArr.push(loc1.rewardCode);
            }
            return;
        }

        public getBigPackArr(arg1: int): Array<any>
        {
            var loc1=arg1;
            switch (loc1) 
            {
                case KingwarNoteType.AUDITIONS:
                {
                    return this._audArr;
                }
                case KingwarNoteType.GROUPGAME:
                {
                    return this._groupArr;
                }
                case KingwarNoteType.FINALGAME:
                {
                    return this._finalArr;
                }
            }
            return [];
        }

        public static get instance(): ArenaRewardConfig
        {
            if (ArenaRewardConfig._instance == null) 
            {
                ArenaRewardConfig._instance = new ArenaRewardConfig();
            }
            return ArenaRewardConfig._instance;
        }

        /* internal */ /* var */_audArr: Array<any>;

        /* internal */ /* var */_groupArr: Array<any>;

        /* internal */ /* var */_finalArr: Array<any>;

        /* internal */ static /* var */_instance: ArenaRewardConfig;
    }
